import QtQuick 1.1
import com.meego 1.0
import "Modulelib.js" as ModuleUtil
import "CommomUtil.js" as Util

Item{
    id: container

    property string specName: ""

    property double specPrice: 0

    property string specEng: ""

    property string specTrain: ""

    property string specOil: ""

    property string specId: "0"

    property string itemType: "item"

    width: 480; height: container.itemType === "dealer" ? 86 : 129

    Item {
        id: info_line
        width: parent.width; height: container.itemType === "dealer" ? 0 : parent.height
        opacity: container.itemType === "dealer" ? 0 : 1

    BorderImage {
        id: item_back
        source: if(backType === "top"){"../images/modelslib/veh_top.png"} else if(backType === "bottom"){"../images/modelslib/veh_down.png"}else{"../images/modelslib/veh_mid.png"}
        width: 451; height: 129
        anchors.top: parent.top;
        anchors.left: parent.left; anchors.leftMargin: 14
    }

    Text{
        id: spec_name
        font{pointSize: 19; bold: true}
        color: "#000000"
        text: container.specName
        horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
        anchors.left: parent.left; anchors.top: parent.top
        anchors.leftMargin: 40; anchors.topMargin: 13
    }
    Text{
        id: spec_price_title
        text: "厂商指导价:"
        font{pointSize: 14; bold: true}
        horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
        color: "#abb2b3"
        anchors.left: spec_name.left; anchors.top: spec_name.bottom
        anchors.topMargin: 4
    }
    Text{
        id: spec_price
        text: (container.specPrice / 10000) + "万"
        font{pointSize: 16; bold: true}
        horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
        color: "red"
        anchors.left: spec_price_title.right; anchors.top: spec_name.bottom
        anchors.topMargin: 4
    }
    Text{
        id: spec_info1
        text: "发动机:"+container.specEng
        font{pointSize: 14; bold: true}
        horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
        anchors.left: spec_price_title.left; anchors.top: spec_price_title.bottom
        anchors.topMargin: 4
        color: "#a4b2b9"
    }
    Text{
        id: spec_info2
        text: "变速箱:" + container.specTrain + " 油耗:"+ container.specOil
        font{pointSize: 14; bold: true}
        horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
        anchors.left: spec_info1.left; anchors.top: spec_info1.bottom
        anchors.topMargin: 4
        color: "#abb2b3"
    }

    MouseArea{
        id: itemMouseArea
        anchors.fill: item_back
        onClicked: {
            ModuleUtil.current_series_id = container.specId;
            ModuleUtil.current_series_name = container.specName;
            Util.openFile("ModuleInfoPage.qml");
        } //打开车型详细页面
    }


    states: [
        State {
            name: 'pressed'; when: itemMouseArea.pressed
            PropertyChanges { target: mouseAreaPressed; focus: true; opacity: 0.5}
        }
    ]

    Rectangle{
        id: mouseAreaPressed
        anchors.fill: parent
        color: "#000"
        opacity: 0
    }

    }
}
